import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ws2812_time/command/config.dart';

import 'logic.dart';

class InfoPage extends StatelessWidget {
  InfoPage({Key? key}) : super(key: key);

  final logic = Get.put(InfoLogic());

  @override
  Widget build(BuildContext context) {
    var rgb = Config.color.split(",").toList();
    Color c = Color.fromARGB(255, int.parse(rgb[0]), int.parse(rgb[1]), int.parse(rgb[2]));

    return Column(
      children: [
        RichText(
          text: TextSpan(
            style: const TextStyle(fontSize: 32),
            text: "IP:",
            children: [
              TextSpan(text: "${Config.host}\n"),
              const TextSpan(text: "MAC:"),
              TextSpan(text: "${Config.mac}\n", style: const TextStyle(color: Colors.redAccent)),
              TextSpan(text: "颜色:", style: TextStyle(color: c)),
              TextSpan(text: "${Config.color}\n"),
              const TextSpan(text: "亮度:"),
              TextSpan(text: "${Config.bright}\n"),
            ],
          ),
        ),
      ],
    );
  }
}
